﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpMUD.Framework.Net
{
    /// <summary>
    /// The signature of a method that can handle an event raised by an INetworkConnection
    /// </summary>
    public delegate void ConnectionEventHandler(INetworkConnection sender, ConnectionEventArgs e);

    /// <summary>
    /// The definition of the arguments that are sent when an event is raised by an INetworkConnection
    /// </summary>
    public class ConnectionEventArgs : System.EventArgs
    {
        #region Private Variables
        /// <summary>
        /// The local IP endpoint of the connection that raised the event
        /// </summary>
        private System.Net.IPEndPoint _LocalEndpoint;
        /// <summary>
        /// The remote IP endpoint of the connection that raised the event
        /// </summary>
        private System.Net.IPEndPoint _RemoteEndpoint;
        #endregion

        #region Public Properties
        /// <summary>
        /// The local IP endpoint of the connection that raised the event
        /// </summary>
        public System.Net.IPEndPoint LocalEndpoint { get { return _LocalEndpoint; } }
        /// <summary>
        /// The remote UP endpoint of the connection that raised the event
        /// </summary>
        public System.Net.IPEndPoint RemoteEndpoint { get { return _RemoteEndpoint; } }
        #endregion

        #region Constructors
        /// <summary>
        /// The default constructor for ConnectionEventArgs
        /// </summary>
        private ConnectionEventArgs()
        {
        }
        /// <summary>
        /// The constructor for ConnectionEventArgs
        /// </summary>
        /// <param name="localEndpoint">The local IP endpoint of the connection that raised the event</param>
        /// <param name="remoteEndpoint">The remote IP endpoint of the connection that raised the event</param>
        public ConnectionEventArgs(System.Net.IPEndPoint localEndpoint, System.Net.IPEndPoint remoteEndpoint)
        {
            this._LocalEndpoint = localEndpoint;
            this._RemoteEndpoint = remoteEndpoint;
        }
        #endregion
    }
}
